<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

		<title>订单管理</title>

		<link href="/Public/one/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
		<link href="/Public/one/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

		<link href="/Public/one/css/personal.css" rel="stylesheet" type="text/css">
		<link href="/Public/one/css/orstyle.css" rel="stylesheet" type="text/css">

		<script src="/Public/one/AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
		<script src="/Public/one/AmazeUI-2.4.2/assets/js/amazeui.js"></script>

	</head>

	<body>
		<!--头 -->
		<header>
			<article>
				<div class="mt-logo">
					<!--顶部导航条 -->
					<include file="Public/tpl/hometop.html"/>
					</div>
				</div>
			</article>
		</header>
            <div class="nav-table">
					   <div class="long-title"><span class="all-goods">全部分类</span></div>
					   <div class="nav-cont">
							<ul>
								<li class="index"><a href="#">首页</a></li>
                                <li class="qc"><a href="#">闪购</a></li>
                                <li class="qc"><a href="#">限时抢</a></li>
                                <li class="qc"><a href="#">团购</a></li>
                                <li class="qc last"><a href="#">大包装</a></li>
							</ul>
						    <div class="nav-extra">
						    	<i class="am-icon-user-secret am-icon-md nav-user"></i><b></b>我的福利
						    	<i class="am-icon-angle-right" style="padding-left: 10px;"></i>
						    </div>
						</div>
			</div>
			<b class="line"></b>
		<div class="center">
			<div class="col-main">
				<div class="main-wrap">

					<div class="user-order">

						<!--标题 -->
						<div class="am-cf am-padding">
							<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">订单管理</strong> / <small>Order</small></div>
						</div>
						<hr/>

						<div class="am-tabs am-tabs-d2 am-margin" data-am-tabs>

							<ul class="am-avg-sm-5 am-tabs-nav am-nav am-nav-tabs">
								<li class="am-active" onclick="freshen()"><a href="#tab1">所有订单</a></li>
								<li onclick="pay()"><a href="#tab2">待付款</a></li>
								<li onclick="sendPro()"><a href="#tab3">待发货</a></li>
								<li onclick="weitPro()"><a href="#tab4">待收货</a></li>
								<li onclick="weitcomment()"><a href="#tab5">待评价</a></li>
							</ul>

							<div class="am-tabs-bd">
								<div class="am-tab-panel am-fade am-in am-active" id="tab1">
									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											<td class="td-inner">商品操作</td>
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>
										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>

									<div class="order-main">
										<div class="order-list">
											
<!--交易成功-->


<div id="allOrder">
<volist name="orderArray" id="value">
<div class="order-status5">
	<div class="order-title">
		<div class="dd-num">订单编号：<a href="javascript:;">{$value.time}</a></div>
		<span>成交时间：{:date('Y-m-d',$value['time'])}</span>
		<!--    <em>店铺：小桔灯</em>-->
	</div>
	<div class="order-content">
		<div class="order-left">
			
			<volist name="value.data" id="data">
			
			<ul class="item-list" alt="{$data.id}">
				<li class="td td-item">
					<div class="item-pic">
						<a href="#" class="J_MakePoint">
							<img src="{$data.images}" class="itempic J_ItemImg">
						</a>
					</div>
					<div class="item-info">
						<div class="item-basic-info">
							<a href="#">
								<p>{$data.name}</p>
								<p class="info-little">
								<volist name="data.property" id="property">
									{$property}</br>

								</volist>

								</p>
							</a>
						</div>
					</div>
				</li>
				<li class="td td-price">
					<div class="item-price">
						{$data.price}
					</div>
				</li>
				<li class="td td-number">
					<div class="item-number">
						<span>×</span><span class="number">{$data.count}</span>
					</div>
				</li>
				<li class="td td-operation">
					<div class="item-operation">
						
					</div>
				</li>
			</ul>
			
			</volist>
			
		</div>
		<div class="order-right">
			<li class="td td-amount">
				<div class="item-amount">
					合计：<div class="total">676.00</div>
					<p>含运费：<span>0.00</span></p>
				</div>
			</li>
			<div class="move-right">
				<li class="td td-status">
					<div class="item-status">
						<p class="Mystatus">交易成功</p>
						<p class="order-info"><a href="orderinfo.html">订单详情</a></p>
						<p class="order-info"><a href="logistics.html">查看物流</a></p>
					</div>
				</li>
				<li class="td td-change">
					<if condition="($value.status eq 已付款)and($value.delivery eq 未发货)">
					<div class="am-btn am-btn-danger anniu" style="margin-left:-12px" onclick="sureUrgent(this)">
						提醒发货</div>
					
					<elseif condition="($value.status eq 已付款)and($value.delivery eq 已发货)"/>
					<div class="am-btn am-btn-danger anniu" style="margin-left:-12px" onclick="surePro(this)">
						确认收货</div>
					<else/>
					<div class="am-btn am-btn-danger anniu" style="margin-left:-12px"  onclick="deleteOrder(this)">
						关闭交易</div>
					</if>
				</li>
			</div>
		</div>
	</div>
</div>


</volist>

</div>



<!--交易失败-->

<!--不同状态订单-->


</div>

</div>

</div>
<div class="am-tab-panel am-fade" id="tab2">

<div class="order-top">
<div class="th th-item">
<td class="td-inner">商品</td>
</div>
<div class="th th-price">
<td class="td-inner">单价</td>
</div>
<div class="th th-number">
<td class="td-inner">数量</td>
</div>
<div class="th th-operation">
<td class="td-inner">商品操作</td>
</div>
<div class="th th-amount">
<td class="td-inner">合计</td>
</div>
<div class="th th-status">
<td class="td-inner">交易状态</td>
</div>
<div class="th th-change">
<td class="td-inner">交易操作</td>
</div>
</div>

<div class="order-main">

<!-- 待付款html-->
 <div class="order-list" id="unpay">



</div>

</div>
</div>
<div class="am-tab-panel am-fade" id="tab3">
<div class="order-top">
<div class="th th-item">
<td class="td-inner">商品</td>
</div>
<div class="th th-price">
<td class="td-inner">单价</td>
</div>
<div class="th th-number">
<td class="td-inner">数量</td>
</div>
<div class="th th-operation">
<td class="td-inner">商品操作</td>
</div>
<div class="th th-amount">
<td class="td-inner">合计</td>
</div>
<div class="th th-status">
<td class="td-inner">交易状态</td>
</div>
<div class="th th-change">
<td class="td-inner">交易操作</td>
</div>
</div>

<div class="order-main">
<div class="order-list">


<!-- 提醒发货 -->
<div id="sendproduct"></div>




</div>
</div>
</div>
<div class="am-tab-panel am-fade" id="tab4">
<div class="order-top">
<div class="th th-item">
<td class="td-inner">商品</td>
</div>
<div class="th th-price">
<td class="td-inner">单价</td>
</div>
<div class="th th-number">
<td class="td-inner">数量</td>
</div>
<div class="th th-operation">
<td class="td-inner">商品操作</td>
</div>
<div class="th th-amount">
<td class="td-inner">合计</td>
</div>
<div class="th th-status">
<td class="td-inner">交易状态</td>
</div>
<div class="th th-change">
<td class="td-inner">交易操作</td>
</div>
</div>

<div class="order-main">
<div class="order-list">

<!-- 待收货 -->

<div id="weitProduct"></div>




</div>
</div>
</div>

<div class="am-tab-panel am-fade" id="tab5">
<div class="order-top">
<div class="th th-item">
<td class="td-inner">商品</td>
</div>
<div class="th th-price">
<td class="td-inner">单价</td>
</div>
<div class="th th-number">
<td class="td-inner">数量</td>
</div>
<div class="th th-operation">
<td class="td-inner">商品操作</td>
</div>
<div class="th th-amount">
<td class="td-inner">合计</td>
</div>
<div class="th th-status">
<td class="td-inner">交易状态</td>
</div>
<div class="th th-change">
<td class="td-inner">交易操作</td>
</div>
</div>

<div class="order-main">
<div class="order-list">
<!--不同状态的订单	-->

<!-- 待评价 -->
<div id="comment"></div>

										</div>

									</div>

								</div>
							</div>

						</div>
					</div>
				</div>
				<!--底部-->
				<div class="footer">
					<div class="footer-hd">
						<p>
							<a href="#">恒望科技</a>
							<b>|</b>
							<a href="#">商城首页</a>
							<b>|</b>
							<a href="#">支付宝</a>
							<b>|</b>
							<a href="#">物流</a>
						</p>
					</div>
					<div class="footer-bd">
						<p>
							<a href="#">关于恒望</a>
							<a href="#">合作伙伴</a>
							<a href="#">联系我们</a>
							<a href="#">网站地图</a>
							<em>© 2015-2025 Hengwang.com 版权所有</em>
						</p>
					</div>

				</div>
			</div>
			<include file="Public/tpl/homeleft.html"/>
		</div>

	</body>
<script src="/Public/js/template-native.js"></script>
<!-- 待付款商品 -->
	<script type="text/html" id="payhtml">

		<%for(var i=0;i< data.length;i++){%>
			<div class="order-status5">
				<div class="order-title">
					<div class="dd-num">订单编号：<a href="javascript:;"><%=data[i].time%></a></div>
					<span>成交时间：<%=getDate(data[i].time)%></span>
					<!--    <em>店铺：小桔灯</em>-->
				</div>
				<div class="order-content">
					<div class="order-left">
						
						<%var prodata=data[i].data%>
						<%for(var j=0;j<prodata.length;j++){%>	
						<ul class="item-list" alt="<%=prodata[j].id%>">
							<li class="td td-item">
								<div class="item-pic">
									<a href="#" class="J_MakePoint">
										<img src="<%=prodata[j].images%>" class="itempic J_ItemImg">
									</a>
								</div>
								<div class="item-info">
									<div class="item-basic-info">
										<a href="#">
											<p><%=prodata[j].name%></p>
											<p class="info-little">
											<%var property=prodata[j].property %>
											<%for(var k=0;k<property.length;k++){%>
												<%=property[k]%></br>

											<%}%>

											</p>
										</a>
									</div>
								</div>
							</li>
							<li class="td td-price">
								<div class="item-price">
									<%=prodata[j].price%>
								</div>
							</li>
							<li class="td td-number">
								<div class="item-number">
									<span>×</span><span class="number"><%=prodata[j].count%></span>
								</div>
							</li>
							<li class="td td-operation">
								<div class="item-operation">
									
								</div>
							</li>
						</ul>
						<%}%>
					
						
					</div>
					<div class="order-right">
						<li class="td td-amount">
							<div class="item-amount">
								合计：<div class="total">676.00</div>
								<p>含运费：<span>0.00</span></p>
							</div>
						</li>
						<div class="move-right">
							<li class="td td-status">
								<div class="item-status">
									<p class="Mystatus">交易成功</p>
									<p class="order-info"><a href="orderinfo.html">订单详情</a></p>
									<p class="order-info"><a href="logistics.html">查看物流</a></p>
								</div>
							</li>
							<li class="td td-change">
								<%if(data[i].status == "已付款" && data[i].delivery == "未发货"){%>
								<div class="am-btn am-btn-danger anniu" style="margin-left:-12px" onclick="sureUrgent(this)">
									提醒发货</div>
								<%}else if(data[i].delivery == "已发货"){%>
								<div class="am-btn am-btn-danger anniu" style="margin-left:-12px" onclick="surePro(this)">
									确认收货</div>
								<%}else if(data[i].status == "未付款"){%>
								<div class="am-btn am-btn-danger anniu" style="margin-left:-12px" onclick="surePay(this)">
									一键付款</div>
								<%}else{%>
								<div class="am-btn am-btn-danger anniu" style="margin-left:-12px" onclick="deleteOrder(this)" >
									关闭交易</div>
								<%}%>
							</li>
						</div>
					</div>
				</div>
			</div>
			</div>
		<%}%>
		
		
	</script>
<!-- 待评论 -->
	<script type="text/html" id="payhtml2">

		<%for(var i=0;i< data.length;i++){%>
			<div class="order-status5">
				<div class="order-title">
					<div class="dd-num">订单编号：<a href="javascript:;"><%=data[i].time%></a></div>
					<span>成交时间：<%=getDate(data[i].time)%></span>
					<!--    <em>店铺：小桔灯</em>-->
				</div>
				<div class="order-content">
					<div class="order-left">
						
						<%var prodata=data[i].data%>
						<%for(var j=0;j<prodata.length;j++){%>	
						<ul class="item-list" alt="<%=prodata[j].id%>">
							<li class="td td-item">
								<div class="item-pic">
									<a href="#" class="J_MakePoint">
										<img src="<%=prodata[j].images%>" class="itempic J_ItemImg">
									</a>
								</div>
								<div class="item-info">
									<div class="item-basic-info">
										<a href="#">
											<p><%=prodata[j].name%></p>
											<p class="info-little">
											<%var property=prodata[j].property %>
											<%for(var k=0;k<property.length;k++){%>
												<%=property[k]%></br>

											<%}%>

											</p>
										</a>
									</div>
								</div>
							</li>
							<li class="td td-price">
								<div class="item-price">
									<%=prodata[j].price%>
								</div>
							</li>
							<li class="td td-number">
								<div class="item-number">
									<span>×</span><span class="number"><%=prodata[j].count%></span>
								</div>
							</li>
							<li class="td td-operation">
								<div class="item-operation">
									
								</div>
							</li>
						</ul>
						<%}%>
					
						
					</div>
					<div class="order-right">
						<li class="td td-amount">
							<div class="item-amount">
								合计：<div class="total">676.00</div>
								<p>含运费：<span>0.00</span></p>
							</div>
						</li>
						<div class="move-right">
							<li class="td td-status">
								<div class="item-status">
									<p class="Mystatus">交易成功</p>
									<p class="order-info"><a href="orderinfo.html">订单详情</a></p>
									<p class="order-info"><a href="logistics.html">查看物流</a></p>
								</div>
							</li>
							<li class="td td-change">
								<div class="am-btn am-btn-danger anniu" style="margin-left:-12px" onclick="pushComment(this)" alt="<%=data[i].time%>">
									待评论</div>
							</li>
						</div>
					</div>
				</div>
			</div>
			</div>
		<%}%>
		
		
	</script>
	
	<script type="text/javascript">
		function getLocalTime(nS) {  			//时间戳
		 return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');  
		}
		function count(){
			$('.total').each(function(){
				var total=0;
				$(this).closest('.order-status5').find('.item-list').each(function(){
					var price=$(this).find('.item-price').html();
					var count=$(this).find('.number').html();
					var singleTotal=parseInt(count)*parseFloat(price);
					total +=singleTotal;
				})
				$(this).html("");
				$(this).html(total.toFixed(2));

			})
		}
		count();

		function pay(){
			$.get('/Api/Index/getPaIfor',{'status':'未付款'},function(ret){
				
				if (ret.status==true) {	
					template.helper('getDate',function(time){
						return getLocalTime(time);
					})		
					var html=template('payhtml',ret);
					$('#unpay').html("");			
					$('#unpay').append(html);
					count();
				}else{
					$('#unpay').html("");	
				}
				
			})
		}
		function sendPro(){
			var param={};
			param.status="已付款";
			param.delivery="未发货";
			$.get('/Api/Index/getPaIfor',param,function(ret){
				
				if (ret.status==true) {	
					template.helper('getDate',function(time){
						return getLocalTime(time);
					})		
					var html=template('payhtml',ret);
					$('#sendproduct').html("");			
					$('#sendproduct').append(html);
					count();
				}else{
					$('#sendproduct').html("");		
				}
				
			})
		}
		function weitPro(){
			var param={};
			param.status="已付款";
			param.delivery="已发货";
			$.get('/Api/Index/getPaIfor',param,function(ret){
				
				if (ret.status==true) {	
					template.helper('getDate',function(time){
						return getLocalTime(time);
					})		
					var html=template('payhtml',ret);
					$('#weitProduct').html("");			
					$('#weitProduct').append(html);
					count();
				}else{
					$('#weitProduct').html("");	
				}
				
			})

		}

		function surePro(obj){      	//确认收货
			arrayId=new Array();
			$(obj).closest('.order-status5').find('.item-list').each(function(){
				var id=$(this).attr('alt');
				arrayId.push(id);

			});
			
			$.post('/Api/Index/changeStatus',{'delivery':'已收货','arrayId':arrayId},function(ret){
					if (ret!=false) {
						alert('订单完成');
						weitPro();
						freshen();
					}
			})

		}
		function surePay(obj){			//确认付款
			arrayId=new Array();
			$(obj).closest('.order-status5').find('.item-list').each(function(){
				var id=$(this).attr('alt');
				arrayId.push(id);
			});
			$.post('/Api/Index/changeStatus',{'status':'已付款','arrayId':arrayId},function(ret){
					if (ret!=false) {
						alert('付款完成');
						pay();
						freshen();
					}
			})

		}

		function sureUrgent(obj){			//是否提醒发货
			arrayId=new Array();
			$(obj).closest('.order-status5').find('.item-list').each(function(){
				var id=$(this).attr('alt');
				arrayId.push(id);
			});
			$.post('/Api/Index/changeStatus',{'urgent':'加急','arrayId':arrayId},function(ret){
					if (ret!=false) {
						alert('已提醒发货');					
					}
			})

		}
		function freshen(){
			$.get('/Api/Index/getPaIfor',null,function(ret){
				if (ret.status==true) {
					template.helper('getDate',function(time){
						return getLocalTime(time);
					})
					var html=template('payhtml',ret);
					$('#allOrder').html("");			
					$('#allOrder').append(html);
					count();

				}

			})
		}
		function weitcomment(){
			$.get('/Api/Index/getPaIfor',{'status':'已付款','delivery':'已收货','comment':'未评论'},function(ret){
				
				if (ret.status==true) {	
					template.helper('getDate',function(time){
						return getLocalTime(time);
					})		
					var html=template('payhtml2',ret);
					$('#comment').html("");			
					$('#comment').append(html);
					count();
				}
				
			})
		}

		function pushComment(obj){
			var time=$(obj).attr('alt');										
			window.location.href="/Home/Comment/index?time="+time;
		}
		function deleteOrder(obj){
			var arrayId=new Array();
			$(obj).closest('.order-status5').find('.item-list').each(function(){
				var id=$(this).attr('alt');
				arrayId.push(id);
			})

			$.get('/Api/Index/deleteOrder',{'arrayId':arrayId},function(ret){
				if (ret!=false) {
					alert("删除成功");
					freshen();
				}

			})
		}
		
	</script>

</html>